<!doctype html>
<title>An upstream caret can be impossible to create</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// This tests that when a selection that ends at [replaced element, 0] is
// painted, the replaced element doesn't appear selected.  This test uses an
// image for the replaced element.
selection_test(
    '<div contenteditable>|abc<img src="../resources/abe.png">def</div>',
    selection => selection.modify('extend', 'forward', 'character'),
    '<div contenteditable>^a|bc<img src="../resources/abe.png">def</div>');
selection_test(
    '<div contenteditable>^a|bc<img src="../resources/abe.png">def</div>',
    selection => selection.modify('extend', 'forward', 'character'),
    '<div contenteditable>^ab|c<img src="../resources/abe.png">def</div>');
selection_test(
    '<div contenteditable>^ab|c<img src="../resources/abe.png">def</div>',
    selection => selection.modify('extend', 'forward', 'character'),
    '<div contenteditable>^abc|<img src="../resources/abe.png">def</div>');
selection_test(
    '<div contenteditable>^abc|<img src="../resources/abe.png">def</div>',
    selection => selection.modify('extend', 'forward', 'character'),
    '<div contenteditable>^abc<img src="../resources/abe.png">|def</div>');
</script>
